//
// Created by 张亦乐 on 2018/9/17.
//

#ifndef PEONY_ARENASRV_HPP
#define PEONY_ARENASRV_HPP

#include <string>
#include "base/Buffer.hpp"

#include "net/TcpConnector.hpp"
#include "net/TcpServer.hpp"
#include "net/Reactor.hpp"

#include "MsgCenter.hpp"
class ArenaSrv
{
private:
    std::string     _name;
    Reactor&        _reactor;
    TcpServer       _tcpServer;
    MsgCenter       _center;
private:
	void updateLogicFrame();//更新逻辑帧
    void onInit();
    TcpConnectorPtr onCreate(Reactor& reactor,int fd,char* name);
    void onConnectedCallback(TcpConnectorPtr);
    void onMessageCallback(TcpConnectorPtr,Buffer&);
    void onClosedCallback(TcpConnectorPtr);
public:
    ArenaSrv(const char*,Reactor&);
    ~ArenaSrv();
    void Loop();
};
#endif //PEONY_ARENASRV_HPP
